home *** CD-ROM | disk | FTP | other *** search
/ Resource for Source: C/C++ / Resource for Source - C-C++.iso / misc_src / sqlsomdb / sample42 / mainform.frm < prev    next >
Text File  |  1995-11-01  |  23KB  |  741 lines

  1. VERSION 2.00
  2. Begin Form Mainform 
  3.    BackColor       =   &H00FFFFC0&
  4.    Caption         =   "Test SQL-Sombrero VBX - Author Application"
  5.    ClientHeight    =   4725
  6.    ClientLeft      =   1185
  7.    ClientTop       =   1350
  8.    ClientWidth     =   7680
  9.    Height          =   5130
  10.    Left            =   1125
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   4725
  13.    ScaleWidth      =   7680
  14.    Top             =   1005
  15.    Width           =   7800
  16.    Begin DEMVBXDB SQLVBXDB1 
  17.       Left            =   180
  18.       Top             =   3900
  19.    End
  20.    Begin ComboBox author_list 
  21.       FontBold        =   -1  'True
  22.       FontItalic      =   0   'False
  23.       FontName        =   "Fixedsys"
  24.       FontSize        =   9
  25.       FontStrikethru  =   0   'False
  26.       FontUnderline   =   0   'False
  27.       Height          =   330
  28.       Left            =   240
  29.       Style           =   2  'Dropdown List
  30.       TabIndex        =   25
  31.       Top             =   120
  32.       Width           =   6855
  33.    End
  34.    Begin CommandButton delbut 
  35.       Caption         =   "Delete Author"
  36.       Height          =   615
  37.       Left            =   6000
  38.       TabIndex        =   24
  39.       Top             =   2040
  40.       Visible         =   0   'False
  41.       Width           =   1335
  42.    End
  43.    Begin CommandButton cancelbut 
  44.       Caption         =   "Cancel"
  45.       Height          =   495
  46.       Left            =   6240
  47.       TabIndex        =   23
  48.       Top             =   3840
  49.       Visible         =   0   'False
  50.       Width           =   855
  51.    End
  52.    Begin CommandButton newrec 
  53.       Caption         =   "Add New"
  54.       Height          =   615
  55.       Left            =   6000
  56.       TabIndex        =   22
  57.       Top             =   1320
  58.       Visible         =   0   'False
  59.       Width           =   1335
  60.    End
  61.    Begin CommandButton updbut 
  62.       Caption         =   "Update Info"
  63.       Height          =   615
  64.       Left            =   6000
  65.       TabIndex        =   21
  66.       Top             =   3120
  67.       Visible         =   0   'False
  68.       Width           =   1335
  69.    End
  70.    Begin CommandButton chgbut 
  71.       Caption         =   "Change Info"
  72.       Height          =   615
  73.       Left            =   6000
  74.       TabIndex        =   20
  75.       Top             =   600
  76.       Visible         =   0   'False
  77.       Width           =   1335
  78.    End
  79.    Begin TextBox Text1 
  80.       Enabled         =   0   'False
  81.       Height          =   285
  82.       Index           =   8
  83.       Left            =   1560
  84.       MaxLength       =   1
  85.       TabIndex        =   19
  86.       Top             =   3480
  87.       Visible         =   0   'False
  88.       Width           =   3855
  89.    End
  90.    Begin TextBox Text1 
  91.       Enabled         =   0   'False
  92.       Height          =   285
  93.       Index           =   7
  94.       Left            =   1560
  95.       MaxLength       =   5
  96.       TabIndex        =   18
  97.       Top             =   3120
  98.       Visible         =   0   'False
  99.       Width           =   3855
  100.    End
  101.    Begin TextBox Text1 
  102.       Enabled         =   0   'False
  103.       Height          =   285
  104.       Index           =   6
  105.       Left            =   1560
  106.       MaxLength       =   2
  107.       TabIndex        =   17
  108.       Top             =   2760
  109.       Visible         =   0   'False
  110.       Width           =   3855
  111.    End
  112.    Begin TextBox Text1 
  113.       Enabled         =   0   'False
  114.       Height          =   285
  115.       Index           =   5
  116.       Left            =   1560
  117.       MaxLength       =   20
  118.       TabIndex        =   16
  119.       Top             =   2400
  120.       Visible         =   0   'False
  121.       Width           =   3855
  122.    End
  123.    Begin TextBox Text1 
  124.       Enabled         =   0   'False
  125.       Height          =   285
  126.       Index           =   4
  127.       Left            =   1560
  128.       MaxLength       =   40
  129.       TabIndex        =   15
  130.       Top             =   2040
  131.       Visible         =   0   'False
  132.       Width           =   3855
  133.    End
  134.    Begin TextBox Text1 
  135.       Enabled         =   0   'False
  136.       Height          =   285
  137.       Index           =   3
  138.       Left            =   1560
  139.       MaxLength       =   12
  140.       TabIndex        =   14
  141.       Top             =   1680
  142.       Visible         =   0   'False
  143.       Width           =   3855
  144.    End
  145.    Begin TextBox Text1 
  146.       Enabled         =   0   'False
  147.       Height          =   285
  148.       Index           =   2
  149.       Left            =   1560
  150.       MaxLength       =   20
  151.       TabIndex        =   13
  152.       Top             =   1320
  153.       Visible         =   0   'False
  154.       Width           =   3855
  155.    End
  156.    Begin TextBox Text1 
  157.       Enabled         =   0   'False
  158.       Height          =   285
  159.       Index           =   1
  160.       Left            =   1560
  161.       MaxLength       =   40
  162.       TabIndex        =   12
  163.       Top             =   960
  164.       Visible         =   0   'False
  165.       Width           =   3855
  166.    End
  167.    Begin TextBox Text1 
  168.       Enabled         =   0   'False
  169.       Height          =   285
  170.       Index           =   0
  171.       Left            =   1560
  172.       MaxLength       =   11
  173.       TabIndex        =   11
  174.       Top             =   600
  175.       Visible         =   0   'False
  176.       Width           =   3855
  177.    End
  178.    Begin CommandButton exitbut 
  179.       Caption         =   "Exit"
  180.       Height          =   375
  181.       Left            =   4200
  182.       TabIndex        =   1
  183.       Top             =   3960
  184.       Width           =   1095
  185.    End
  186.    Begin CommandButton multibut 
  187.       Caption         =   "Logon"
  188.       Height          =   375
  189.       Left            =   1320
  190.       TabIndex        =   0
  191.       Top             =   3960
  192.       Width           =   1095
  193.    End
  194.    Begin Shape Shape2 
  195.       BorderWidth     =   3
  196.       Height          =   2295
  197.       Left            =   5880
  198.       Top             =   480
  199.       Visible         =   0   'False
  200.       Width           =   1575
  201.    End
  202.    Begin Shape Shape1 
  203.       BorderWidth     =   3
  204.       Height          =   1455
  205.       Left            =   5880
  206.       Top             =   3000
  207.       Visible         =   0   'False
  208.       Width           =   1575
  209.    End
  210.    Begin Label Label1 
  211.       Alignment       =   1  'Right Justify
  212.       BackColor       =   &H00FFFFC0&
  213.       Caption         =   "Contract :"
  214.       Height          =   255
  215.       Index           =   8
  216.       Left            =   120
  217.       TabIndex        =   10
  218.       Top             =   3480
  219.       Visible         =   0   'False
  220.       Width           =   1215
  221.    End
  222.    Begin Label Label1 
  223.       Alignment       =   1  'Right Justify
  224.       BackColor       =   &H00FFFFC0&
  225.       Caption         =   "ZIP :"
  226.       Height          =   255
  227.       Index           =   7
  228.       Left            =   120
  229.       TabIndex        =   9
  230.       Top             =   3120
  231.       Visible         =   0   'False
  232.       Width           =   1215
  233.    End
  234.    Begin Label Label1 
  235.       Alignment       =   1  'Right Justify
  236.       BackColor       =   &H00FFFFC0&
  237.       Caption         =   "State :"
  238.       Height          =   255
  239.       Index           =   6
  240.       Left            =   120
  241.       TabIndex        =   8
  242.       Top             =   2760
  243.       Visible         =   0   'False
  244.       Width           =   1215
  245.    End
  246.    Begin Label Label1 
  247.       Alignment       =   1  'Right Justify
  248.       BackColor       =   &H00FFFFC0&
  249.       Caption         =   "City :"
  250.       Height          =   255
  251.       Index           =   5
  252.       Left            =   120
  253.       TabIndex        =   7
  254.       Top             =   2400
  255.       Visible         =   0   'False
  256.       Width           =   1215
  257.    End
  258.    Begin Label Label1 
  259.       Alignment       =   1  'Right Justify
  260.       BackColor       =   &H00FFFFC0&
  261.       Caption         =   "Address :"
  262.       Height          =   255
  263.       Index           =   4
  264.       Left            =   120
  265.       TabIndex        =   6
  266.       Top             =   2040
  267.       Visible         =   0   'False
  268.       Width           =   1215
  269.    End
  270.    Begin Label Label1 
  271.       Alignment       =   1  'Right Justify
  272.       BackColor       =   &H00FFFFC0&
  273.       Caption         =   "Phone # :"
  274.       Height          =   255
  275.       Index           =   3
  276.       Left            =   120
  277.       TabIndex        =   5
  278.       Top             =   1680
  279.       Visible         =   0   'False
  280.       Width           =   1215
  281.    End
  282.    Begin Label Label1 
  283.       Alignment       =   1  'Right Justify
  284.       BackColor       =   &H00FFFFC0&
  285.       Caption         =   "First Name :"
  286.       Height          =   255
  287.       Index           =   2
  288.       Left            =   120
  289.       TabIndex        =   4
  290.       Top             =   1320
  291.       Visible         =   0   'False
  292.       Width           =   1215
  293.    End
  294.    Begin Label Label1 
  295.       Alignment       =   1  'Right Justify
  296.       BackColor       =   &H00FFFFC0&
  297.       Caption         =   "Last Name :"
  298.       Height          =   255
  299.       Index           =   1
  300.       Left            =   120
  301.       TabIndex        =   3
  302.       Top             =   960
  303.       Visible         =   0   'False
  304.       Width           =   1215
  305.    End
  306.    Begin Label Label1 
  307.       Alignment       =   1  'Right Justify
  308.       BackColor       =   &H00FFFFC0&
  309.       Caption         =   "Author Id :"
  310.       Height          =   255
  311.       Index           =   0
  312.       Left            =   120
  313.       TabIndex        =   2
  314.       Top             =   600
  315.       Visible         =   0   'False
  316.       Width           =   1215
  317.    End
  318. End
  319.  
  320.  
  321. Dim t(1 To 3) As String
  322.  
  323. Sub author_list_Click ()
  324.     show_author
  325.     chgbut.Visible = True
  326.     delbut.Visible = True
  327. End Sub
  328.  
  329. Sub cancelbut_Click ()
  330.     author_list.Enabled = True
  331.     If author_list.ListIndex <> -1 Then
  332.     chgbut.Visible = True
  333.     delbut.Visible = True
  334.     End If
  335.     updbut.Visible = False
  336.     newrec.Visible = True
  337.     cancelbut.Visible = False
  338.     For i = 0 To 8
  339.     text1(i).Enabled = False
  340.     Next
  341.     show_author
  342. End Sub
  343.  
  344. Sub chgbut_Click ()
  345.     For i = 1 To 8
  346.        text1(i).Enabled = True
  347.     Next
  348.     author_list.Enabled = False
  349.     chgbut.Visible = False
  350.     updbut.Visible = True
  351.     newrec.Visible = False
  352.     delbut.Visible = False
  353.     cancelbut.Visible = True
  354.     updflag = 1
  355.     text1(1).SetFocus
  356. End Sub
  357.  
  358. Sub delbut_Click ()
  359.     updflag = 3
  360.     updbut.Visible = True
  361.     chgbut.Visible = False
  362.     newrec.Visible = False
  363.     cancelbut.Visible = True
  364.     delbut.Visible = False
  365.     author_list.Enabled = False
  366. End Sub
  367.  
  368. Sub exitbut_Click ()
  369.     If dbconn <> 0 Then
  370.     SqlClose (dbconn)
  371.     End If
  372.     sqlwinexit
  373.     sqlexit
  374.     End
  375. End Sub
  376.  
  377. Sub Form_Load ()
  378.     updflag = 0
  379. End Sub
  380.  
  381. Sub multibut_Click ()
  382.     logon.Show 1
  383.     If multibut.Visible = True Then
  384.     Exit Sub
  385.     End If
  386.     newrec.Visible = True
  387.     
  388. '   Once the user has logged on to the server the list box will be
  389. '   populated with a list of the Author Id, Last Name, and First Name
  390. '
  391. '   The first function is to place the SQL Statement required to get
  392. '   this information from the server into the command buffer using
  393. '   the SqlCmd function
  394.  
  395.     ret = SqlCmd(dbconn, "select 'Author Id' = au_id , 'Last Name' = au_lname , 'First Name' = au_fname  from authors")
  396.     If ret = 1 Then
  397.  
  398. '   The SqlExec function is then used to send the SQL Statement to the
  399. '   server for execution. It is at this point that syntax checking is
  400. '   performed
  401.  
  402.     ret = SqlExec(dbconn)
  403.     If ret = 1 Then
  404.         
  405. '   If the command syntax was correct the command will be executing at
  406. '   the server now. The next function is the SqlResults function. This
  407. '   function will return once the processing is complete on the server.
  408. '
  409. '   If the SqlCmd function had been passed more than one SQL command then
  410. '   you must perform a SqlResults for each result set being sent back.
  411. '   The end of result sets will be indicated by a NOMORERESUTLS(2) return
  412. '   from SqlResults
  413.  
  414.         ret = SqlResults(dbconn)
  415.         If ret = 1 Then
  416.  
  417. '   Once the SqlResults returns with the indication that a result set
  418. '   is available we can get the number of columns in the result set. In
  419. '   this application this function is not required since we know how
  420. '   many columns were requested. If the application allowed for AdHoc
  421. '   SQL requests then this function is used to indicate the number of
  422. '   columns of data available.
  423.  
  424.         cols% = SqlNumCols(dbconn)
  425.  
  426. '   To get the column headings we use the SqlColName function. This function
  427. '   will return either the column name based on the internal column name or
  428. '   if the syntax 'Column Name' = colname is used to override the internal
  429. '   column name. In our example we have chosen to override the column name
  430.  
  431.         For c% = 1 To cols%
  432.             colnam$ = SqlColName(dbconn, c%)
  433.         Next
  434.  
  435. '   Once the result set is available for processing each row needs to be
  436. '   retrieved. This is accomplished by calling SqlNextRow until the function
  437. '   returns NOMOREROWS(-2)
  438.  
  439.         ret = SqlNextRow(dbconn)
  440.         While ret <> NOMOREROWS
  441.  
  442. '   For each column in the result set we call the function SqlData to
  443. '   get the data returned for the column. The data returned is a string
  444. '   representation of the data in the result column. The data is right
  445. '   trimmed when returned. The data when return is being concatonated
  446. '   with tabs (chr(9)) between each item to populate the drop down list
  447. '   box with three columns
  448.             
  449.             
  450.             For c% = 1 To cols%
  451.             t(c%) = SqlData(dbconn, c%)
  452.             Next
  453.             aitem$ = t(1) & Space(15 - Len(t(1))) & Left(t(2) & Space(41 - Len(t(2))), 20) & t(3)
  454.             author_list.AddItem aitem$
  455.             ret = SqlNextRow(dbconn)
  456.         Wend
  457.         End If
  458.     End If
  459.     End If
  460.     If ret <> NOMOREROWS Then
  461.     Exit Sub
  462.     End If
  463.     For i = 0 To 8
  464.     label1(i).Visible = True
  465.     text1(i).Visible = True
  466.     Next
  467.     author_list.Visible = True
  468.     newrec.Visible = True
  469.     shape1.Visible = True
  470.     shape2.Visible = True
  471. End Sub
  472.  
  473. Sub newrec_Click ()
  474.     updflag = 2
  475.     updbut.Visible = True
  476.     chgbut.Visible = False
  477.     newrec.Visible = False
  478.     cancelbut.Visible = True
  479.     delbut.Visible = False
  480.     author_list.Enabled = False
  481.     For i = 0 To 8
  482.     text1(i).Enabled = True
  483.     text1(i).Text = ""
  484.     Next
  485.     text1(0).SetFocus
  486. End Sub
  487.  
  488. Function process_no_rows () As Integer
  489.  
  490. '   If the SQL Statement was successfully placed into the command buffer then
  491. '   send the command to the server for execution.
  492.  
  493.     ret = SqlExec(dbconn)
  494.     If ret = 1 Then
  495.  
  496. '   The SqlResults function will wait until the function is complete on
  497. '   the server. A return of 1 indicates that the statement has been executed
  498. '   on the server
  499.  
  500.     ret = SqlResults(dbconn)
  501.     If ret = 1 Then
  502.  
  503. '   In the case of a delete there are no rows returned in the result set
  504. '   the SqlRows command will confirm that no rows were returned.
  505.  
  506.         ret = SqlRows(dbconn)
  507.         If ret = 1 Then
  508.         MsgBox "This command should not return rows"
  509.         Else
  510.         If updflag = 1 Then
  511.             MsgBox "Information changed for au_id " & text1(0).Text
  512.         Else
  513.             If updflag = 2 Then
  514.             MsgBox "Information added for au_id " & text1(0).Text
  515.             Else
  516.             MsgBox "Information deleted for au_id " & text1(0).Text
  517.             End If
  518.         End If
  519.         End If
  520.     Else
  521.         process_no_rows = ret
  522.         Exit Function
  523.     End If
  524.     Else
  525.     process_no_rows = ret
  526.     Exit Function
  527.     End If
  528.     process_no_rows = 99
  529. End Function
  530.  
  531. Sub show_author ()
  532.     lc = author_list.ListIndex
  533.     If lc = -1 Then
  534.     Exit Sub
  535.     End If
  536. '    author_list.Row = lc
  537. '    author_list.Col = 0
  538.     d$ = RTrim(Left(author_list.List(lc), 15))
  539. '
  540. '   Once the author has been selected from the list of authors
  541. '   process a SQL Statement which will select all the fields
  542. '   from the authors table for the author selected from the list
  543. '   by using the where clause on the primary key of the table
  544. '
  545. '   The checking the ret variable for 1 indicates a test for a
  546. '   success. If the ret variable contains a 0 then the function
  547. '   failed
  548.  
  549.     ret = SqlCmd(dbconn, "select * from authors where au_id = " & Chr(34) & d$ & Chr$(34))
  550.     If ret = 1 Then
  551.     
  552. '   If the command was accepted into the buffer in the statement above
  553. '   then send it to the server for execution. If there are syntax
  554. '   errors in the statement then they will be found in the SqlExec step
  555.  
  556.     ret = SqlExec(dbconn)
  557.     If ret = 1 Then
  558.  
  559. '   If the command syntax was correct the command will be executing at
  560. '   the server now. The next function is the SqlResults function. This
  561. '   function will return once the processing is complete on the server.
  562. '
  563. '   If the SqlCmd function had been passed more than one SQL command then
  564. '   you must perform a SqlResults for each result set being sent back.
  565. '   The end of result sets will be indicated by a NOMORERESUTLS(2) return
  566. '   from SqlResults
  567.  
  568.         ret = SqlResults(dbconn)
  569.         If ret = 1 Then
  570.  
  571. '   Once the result set is available for processing each row needs to be
  572. '   retrieved. This is accomplished by calling SqlNextRow until the function
  573. '   returns NOMOREROWS(-2)
  574.  
  575.         ret = SqlNextRow(dbconn)
  576.         While ret <> NOMOREROWS
  577.  
  578. '   For each column in the result set we call the function SqlData to
  579. '   get the data returned for the column. The data returned is a string
  580. '   representation of the data in the result column. The data is right
  581. '   trimmed when returned.
  582.  
  583.             For c% = 1 To 9
  584.             dat$ = SqlData(dbconn, c%)
  585.             text1(c% - 1).Text = dat$
  586.             Next
  587.             ret = SqlNextRow(dbconn)
  588.         Wend
  589.         End If
  590.     End If
  591.     End If
  592. End Sub
  593.  
  594. Sub SQLVBXDB1_ERROR (Sqlconn As Integer, Severity As Integer, ErrorNum As Integer, OsError As Integer, ErrorStr As String, OsErrorStr As String, RetCode As Integer)
  595.  
  596. '   This is a SQL Server callback routine
  597. '
  598. '   When the server needs to inform the user of a error this callback is
  599. '   called. For example if the user tries to logon to a server which does
  600. '   not exist then the error message string (errorstr) will contain text
  601. '   indicating that a connection with the requested server cannot be made.
  602. '   It is also this routine which is called when syntax errors are discovered
  603. '   in SQL commands submitted for execution.
  604.  
  605.     MsgBox ErrorStr
  606. End Sub
  607.  
  608. Sub SQLVBXDB1_MESSAGE (Sqlconn As Integer, Message As Long, State As Integer, Severity As Integer, msgstr As String, ServerName As String, ProcName As String, LineNum As Integer)
  609.  
  610. '   This is a SQL Server callback routine
  611. '
  612. '   When the server needs to inform the user of a status change this callback is
  613. '   used. For example when the user changes databases using the SqlUse function
  614. '   this event procedure will be called and the message string (msgstr) will
  615. '   contain text indicating the new database name.
  616. '   The variable severity can be used to filter the messages so that only messages
  617. '   which need to be seen can be displayed to the user
  618.  
  619.     MsgBox msgstr
  620. End Sub
  621.  
  622. Sub Text1_KeyPress (index As Integer, keyascii As Integer)
  623.     If updflag = 0 Then
  624.     keyascii = 0
  625.     End If
  626. End Sub
  627.  
  628. Sub updbut_Click ()
  629.     Dim sql As String
  630.     If updflag = 3 Then
  631.     GoTo dontcheck
  632.     End If
  633.  
  634.     If text1(0).Text = "" Then
  635.     MsgBox "Author Id cannot be NULL"
  636.     Exit Sub
  637.     End If
  638.     If text1(1).Text = "" Then
  639.     MsgBox "Last name cannot be NULL"
  640.     Exit Sub
  641.     End If
  642.     If text1(2).Text = "" Then
  643.     MsgBox "First name cannot be NULL"
  644.     Exit Sub
  645.     End If
  646.     If text1(3).Text = "" Then
  647.     MsgBox "Phone # cannot be NULL"
  648.     Exit Sub
  649.     End If
  650.     If text1(8).Text = "" Then
  651.     MsgBox "Contract cannot be NULL"
  652.     Exit Sub
  653.     End If
  654.  
  655. dontcheck:
  656.  
  657.  
  658.     If updflag = 1 Then
  659.  
  660. '   In this application if the updflag is set to 1 then we are modifing the
  661. '   data for a particular row in the table authors. The following code will
  662. '   create a SQL Statement to 'UPDATE' the authors table where the au_id field
  663. '   is equal to the requested author id.
  664.     
  665.     sql = "update authors set "
  666.     sql = sql & " au_lname = " & Chr(34) & text1(1).Text & Chr(34) & " ,"
  667.     sql = sql & " au_fname = " & Chr(34) & text1(2).Text & Chr(34) & " ,"
  668.     sql = sql & " phone = " & Chr(34) & text1(3).Text & Chr(34) & " ,"
  669.     sql = sql & " address = " & Chr(34) & text1(4).Text & Chr(34) & " ,"
  670.     sql = sql & " city = " & Chr(34) & text1(5).Text & Chr(34) & " ,"
  671.     sql = sql & " state = " & Chr(34) & text1(6).Text & Chr(34) & " ,"
  672.     sql = sql & " zip = " & Chr(34) & text1(7).Text & Chr(34) & " ,"
  673.     sql = sql & " contract = convert(bit," & Chr(34) & text1(8).Text & Chr(34) & ")"
  674.     sql = sql & " where au_id = " & Chr(34) & text1(0).Text & Chr(34)
  675.     Else
  676.     If updflag = 2 Then
  677.  
  678. '   In this application if the updflag is set to 2 then we are adding
  679. '   data for a particular row in the table authors. The following code will
  680. '   create a SQL Statement to 'INSERT' a row into the authors table where the
  681. '   au_id field is equal to the requested author id.
  682.         
  683.         sql = "insert authors values ("
  684.         For i = 0 To 7
  685.         sql = sql & Chr(34) & text1(i).Text & Chr(34) & " , "
  686.         Next
  687.         sql = sql & "convert(bit," & Chr(34) & text1(8).Text & Chr(34) & "))"
  688.     Else
  689.  
  690. '   In this application if the updflag is set to 3 then we are deleting
  691. '   an author record from the table
  692. '   The SQL statement will delete a row from the table based on the
  693. '   primary key (au_id)
  694.  
  695.         sql = "delete from authors where au_id = " & Chr(34) & text1(0).Text & Chr(34)
  696.     
  697.     End If
  698.     End If
  699.  
  700.  
  701.     ret = SqlCmd(dbconn, sql)
  702.     If ret = 1 Then
  703.  
  704. '   If the command was successfully placed in the command buffer then call
  705. '   the subroutine to process a SQL Statement with no rows being returned
  706.  
  707.     ret = process_no_rows()
  708.     End If
  709.  
  710.     If ret = 99 Then
  711.     If updflag = 2 Then
  712.         aitem$ = text1(0).Text & Space(15 - Len(text1(0).Text)) & Left(text1(1).Text & Space(41 - Len(text1(1).Text)), 20) & text1(2).Text
  713.         author_list.AddItem aitem$
  714.         author_list.ListIndex = author_list.ListCount - 1
  715.     Else
  716.         If updflag = 1 Then
  717.         aitem$ = text1(0).Text & Space(15 - Len(text1(0).Text)) & Left(text1(1).Text & Space(41 - Len(text1(1).Text)), 20) & text1(2).Text
  718.         lc = author_list.ListIndex
  719.         author_list.List(lc) = aitem$
  720.         Else
  721.         lc = author_list.ListIndex
  722.         author_list.RemoveItem lc
  723.         author_list.ListIndex = 0
  724.         End If
  725.     End If
  726.     Else
  727.     Exit Sub
  728.     End If
  729.  
  730.     author_list.Enabled = True
  731.     chgbut.Visible = True
  732.     updbut.Visible = False
  733.     newrec.Visible = True
  734.     cancelbut.Visible = False
  735.     delbut.Visible = True
  736.     For i = 0 To 8
  737.     text1(i).Enabled = False
  738.     Next
  739. End Sub
  740.  
  741.